Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Sql] az sql mi start/stop/start-stop-schedule: Add SQL MI manual and scheduled start stop #26979

Merged
merged 14 commits into from
Jul 25, 2023

Conversation

ReneaMoso
Copy link
Contributor

Related command
In this PR I add new commands for manual and scheduled start stop for Azure SQL Managed Instance. The commands were generated using the CodeGen tool, while tests were manually written.

Description

Here are the new commands with examples:

Manual start stop:

Start a managed instance.
az sql mi start --ids resourceId
az sql mi start --mi miName -g resourceGroup --subscription subscription

Stop a managed instance.
az sql mi stop --ids resourceId
az sql mi stop --mi miName -g resourceGroup --subscription subscription

Scheduled start stop:

Create schedule for managed instance.
az sql mi startstopschedule create --mi miName -g resourceGroup --subscription subscriptionId --schedule-list "[{'startDay':'Monday','startTime':'10:00 AM','stopDay':'Monday','stopTime':'12:00 AM'}]"

Delete a managed instance start stop schedule.
az sql mi startstopschedule delete --ids resourceId
az sql mi startstopschedule delete --mi miName -g resourceGroup --subscription subscriptionId

Lists the managed instance's start stop schedule.
az sql mi startstopschedule list --ids resourceId
az sql mi startstopschedule list --mi miName -g resourceGroup --subscription subscriptionId

Get the managed instance's start stop schedule.
az sql mi startstopschedule show --ids resourceId
az sql mi startstopschedule show --mi miName -g resourceGroup --subscription subscriptionId

Testing Guide
Commands can be tested as shown above in the example.


This checklist is used to make sure that common guidelines for a pull request are followed.

@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 24, 2023

️✔️AzureCLI-FullTest
️✔️acr
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️acs
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️advisor
️✔️latest
️✔️3.10
️✔️3.9
️✔️ams
️✔️latest
️✔️3.10
️✔️3.9
️✔️apim
️✔️latest
️✔️3.10
️✔️3.9
️✔️appconfig
️✔️latest
️✔️3.10
️✔️3.9
️✔️appservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️aro
️✔️latest
️✔️3.10
️✔️3.9
️✔️backup
️✔️latest
️✔️3.10
️✔️3.9
️✔️batch
️✔️latest
️✔️3.10
️✔️3.9
️✔️batchai
️✔️latest
️✔️3.10
️✔️3.9
️✔️billing
️✔️latest
️✔️3.10
️✔️3.9
️✔️botservice
️✔️latest
️✔️3.10
️✔️3.9
️✔️cdn
️✔️latest
️✔️3.10
️✔️3.9
️✔️cloud
️✔️latest
️✔️3.10
️✔️3.9
️✔️cognitiveservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️config
️✔️latest
️✔️3.10
️✔️3.9
️✔️configure
️✔️latest
️✔️3.10
️✔️3.9
️✔️consumption
️✔️latest
️✔️3.10
️✔️3.9
️✔️container
️✔️latest
️✔️3.10
️✔️3.9
️✔️core
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️cosmosdb
️✔️latest
️✔️3.10
️✔️3.9
️✔️databoxedge
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️dla
️✔️latest
️✔️3.10
️✔️3.9
️✔️dls
️✔️latest
️✔️3.10
️✔️3.9
️✔️dms
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventgrid
️✔️latest
️✔️3.10
️✔️3.9
️✔️eventhubs
️✔️latest
️✔️3.10
️✔️3.9
️✔️feedback
️✔️latest
️✔️3.10
️✔️3.9
️✔️find
️✔️latest
️✔️3.10
️✔️3.9
️✔️hdinsight
️✔️latest
️✔️3.10
️✔️3.9
️✔️identity
️✔️latest
️✔️3.10
️✔️3.9
️✔️iot
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️keyvault
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️kusto
️✔️latest
️✔️3.10
️✔️3.9
️✔️lab
️✔️latest
️✔️3.10
️✔️3.9
️✔️managedservices
️✔️latest
️✔️3.10
️✔️3.9
️✔️maps
️✔️latest
️✔️3.10
️✔️3.9
️✔️marketplaceordering
️✔️latest
️✔️3.10
️✔️3.9
️✔️monitor
️✔️latest
️✔️3.10
️✔️3.9
️✔️mysql
️✔️latest
️✔️3.10
️✔️3.9
️✔️netappfiles
️✔️latest
️✔️3.10
️✔️3.9
️✔️network
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️policyinsights
️✔️latest
️✔️3.10
️✔️3.9
️✔️privatedns
️✔️latest
️✔️3.10
️✔️3.9
️✔️profile
️✔️latest
️✔️3.10
️✔️3.9
️✔️rdbms
️✔️latest
️✔️3.10
️✔️3.9
️✔️redis
️✔️latest
️✔️3.10
️✔️3.9
️✔️relay
️✔️latest
️✔️3.10
️✔️3.9
️✔️resource
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️role
️✔️latest
️✔️3.10
️✔️3.9
️✔️search
️✔️latest
️✔️3.10
️✔️3.9
️✔️security
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicebus
️✔️latest
️✔️3.10
️✔️3.9
️✔️serviceconnector
️✔️latest
️✔️3.10
️✔️3.9
️✔️servicefabric
️✔️latest
️✔️3.10
️✔️3.9
️✔️signalr
️✔️latest
️✔️3.10
️✔️3.9
️✔️sql
️✔️latest
️✔️3.10
️✔️3.9
️✔️sqlvm
️✔️latest
️✔️3.10
️✔️3.9
️✔️storage
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️synapse
️✔️latest
️✔️3.10
️✔️3.9
️✔️telemetry
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9
️✔️util
️✔️latest
️✔️3.10
️✔️3.9
️✔️vm
️✔️2018-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2019-03-01-hybrid
️✔️3.10
️✔️3.9
️✔️2020-09-01-hybrid
️✔️3.10
️✔️3.9
️✔️latest
️✔️3.10
️✔️3.9

@azure-client-tools-bot-prd
Copy link

Hi @ReneaMoso,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

@ghost ghost added the Auto-Assign Auto assign by bot label Jul 24, 2023
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Jul 24, 2023

⚠️AzureCLI-BreakingChangeTest
⚠️sql
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd sql mi start cmd sql mi start added
⚠️ 1011 - SubgroupAdd sql mi start-stop-schedule sub group sql mi start-stop-schedule added
⚠️ 1001 - CmdAdd sql mi stop cmd sql mi stop added

@ghost ghost added the SQL az sql label Jul 24, 2023
@yonzhan
Copy link
Collaborator

yonzhan commented Jul 24, 2023

az sql

@ReneaMoso ReneaMoso changed the title [az sql] Add SQL MI manual and scheduled start stop [az sql] Add SQL MI manual and scheduled start stop Jul 24, 2023
@evelyn-ys evelyn-ys changed the title [az sql] Add SQL MI manual and scheduled start stop [Sql]az sql mi: Add SQL MI manual and scheduled start stop Jul 25, 2023
@AllowLargeResponse()
def test_sql_mi_startstop_mgmt(self):
rg = 'CustomerExperienceTeam_RG'
mi = 'clitestmilb5hsyvgolc22pa3zzf2urno3uwskko4us2mbcti2gebgawczstsm'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the test with ResourceGroupPreparer and ManagedInstancePreparer instead of using fixed test resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are having an issue with preparing a Managed Instance, since for this feature we require a Managed Instance on a v2 cluster, and our cluster tries to resize during every MI create, the creation lasts for >3hrs. Due to that, the CLI test that I initially wrote that prepares the MI gets an error about a refused connection:
image
I'm guessing it happens due to a timeout because creation takes too long. I will be addressing this in the next snap by preparing our test ring to not resize during create, which will shorten the duration of creation time.

@evelyn-ys evelyn-ys changed the title [Sql]az sql mi: Add SQL MI manual and scheduled start stop [Sql] az sql mi start/stop/start-stop-schedule: Add SQL MI manual and scheduled start stop Jul 25, 2023
@evelyn-ys evelyn-ys merged commit 460cb2d into Azure:dev Jul 25, 2023
55 checks passed
avgale pushed a commit to avgale/azure-cli that referenced this pull request Aug 24, 2023
…nd scheduled start stop (Azure#26979)

* Kerberos win auth initial commit

* fixing conflicts

* fixing conflicts 2

* generating cmdlets for manual start stop

* adding examples for manual start stop

* adding scheduled start stop commands except create

* adding create command for scheduledstartstop

* writing tests

* fixing examples, adding tests

* test fix

* addressing comments

---------

Co-authored-by: Renea Moso <a-reneamoso@microsoft.com>
Co-authored-by: Renea Moso <reneamoso@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auto-Assign Auto assign by bot SQL az sql
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants